package option;

import model.Author;
import model.GetAuthors;
import model.GetAuthors_Optional;

import java.util.List;
import java.util.Optional;

public class Filter {
    public static void main1(String[] args) {
//        List<Author> authors = GetAuthors.getAuthors();
//        Optional<List<Author>> authors1 = Optional.ofNullable(authors);
//        authors1.filter(authors2 -> authors2.)
    }

    public static void main(String[] args) {
        Optional<Author> author = GetAuthors_Optional.getAuthor();
        Optional<Author> optional = author.filter(author1 -> author1.getAge() > 30);
        optional.ifPresent(author1 -> System.out.println(author1.getName()+" age:"+author1.getAge()));


    }


}
